import {debounce} from './utils.js'

export const itemListener = {
  data(){
    return{
      itemImgListrner: null
    }
  },
  mounted(){
    //进行防抖操作
    const refresh = debounce(this.$refs.scroll.refresh, 100)

    this.itemImgListrner = () => {
      refresh()
    }
    this.$bus.$on('itemImageLoad', this.itemImgListrner)
  }
}

export const backTopMixin = {
  data(){
    return{
      isShowBackTop:false
    }
  },
  methods:{
    backClick(){
      this.$refs.scroll.scrollTo(0,0)
    }
  }
}
